package com.guxingke.typecho4j.route;

import com.guxingke.typecho4j.widget.WidgetRoute;

/**
 * typecho4j的路由定义
 * 
 * @author guxingke
 */
public final class Route {
	/**
	 * 路由响应关键字
	 */
	String responseKey;

	/**
	 * 处理组件类
	 */
	Class<? extends WidgetRoute> routeClass;

	/**
	 * 处理组件类型，do组件和其他组件
	 */
	WidgetType widgetType;

	/**
	 * 视图路径
	 */
	String viewPath;

	/**
	 * 响应视图策略，分发和重定向
	 */
	DispatcherStrategy dispatcherStrategy;

	public Route(String responseKey,
			Class<? extends WidgetRoute> routeClass, String viewPath) {
		this.responseKey = responseKey;
		this.routeClass = routeClass;
		this.viewPath = viewPath;
		this.dispatcherStrategy = DispatcherStrategy.FORWARD;
	}

	public Route(String responseKey,
			Class<? extends WidgetRoute> routeClass,
			String viewPath, DispatcherStrategy dispatcherStrategy) {
		this.responseKey = responseKey;
		this.routeClass = routeClass;
		this.viewPath = viewPath;
		this.dispatcherStrategy = dispatcherStrategy;
	}

	public Route(String responseKey,
			Class<? extends WidgetRoute> routeClass,
			WidgetType widgetType, String viewPath,
			DispatcherStrategy dispatcherStrategy) {
		this.responseKey = responseKey;
		this.routeClass = routeClass;
		this.widgetType = widgetType;
		this.viewPath = viewPath;
		this.dispatcherStrategy = dispatcherStrategy;
	}

	public String getResponseKey() {
		return responseKey;
	}

	public Class<? extends WidgetRoute> getRouteClass() {
		return routeClass;
	}

	public WidgetType getWidgetType() {
		return widgetType;
	}

	public String getViewPath() {
		return viewPath;
	}

	public DispatcherStrategy getDispatcherStrategy() {
		return dispatcherStrategy;
	}
}
